$(function() {
	admin.idleBase.init();
});
Namespace('admin.idleBase', {
	init : function() {
		easyui.util.initDatagrid('#datagrid', {
			onDblClickRow : function() {
			}
		});
	},
	query : function() {
		if (!$('#query-form').form('validate'))
			return;
		var data = $('#query-form').form('jsonObject');
		$('#datagrid').datagrid('load', data);
	},
	unclaimed:function(id) {
		var url = contextPath + '/idle/base/unclaimed';
        $('#datagrid').datagrid('loading');
		$.post(url, {id:id}, function (result) {
			 $('#datagrid').datagrid('loaded');
			if (result.code == 1) {
				top.showInfo('删除成功');
				top.addTab("1",'闲置品基础列表', contextPath+'/idle/base/list');
			} else {
				top.showInfo(result.msg);
			}
		});
	},
	receive:function(id) {
		var url = contextPath + '/idle/base/receive';
        $('#datagrid').datagrid('loading');
		$.post(url, {id:id}, function (result) {
			 $('#datagrid').datagrid('loaded');
			if (result.code == 1) {
				top.showInfo('恢复成功');
				top.addTab("1",'闲置品基础列表', contextPath+'/idle/base/list');
			} else {
				top.showInfo(result.msg);
			}
		});
	},
	myShow:function(id) {
		var url = contextPath + '/idle/base/myShow';
        $('#datagrid').datagrid('loading');
		$.post(url, {id:id}, function (result) {
			 $('#datagrid').datagrid('loaded');
			if (result.code == 1) {
				top.showInfo('操作成功');
				top.addTab("1",'闲置品基础列表', contextPath+'/idle/base/list');
			} else {
				top.showInfo(result.msg);
			}
		});
	},
	isShow:function(id) {
		var url = contextPath + '/idle/base/isShow';
        $('#datagrid').datagrid('loading');
		$.post(url, {id:id}, function (result) {
			 $('#datagrid').datagrid('loaded');
			if (result.code == 1) {
				top.showInfo('操作成功');
				top.addTab("1",'闲置品基础列表', contextPath+'/idle/base/list');
			} else {
				top.showInfo(result.msg);
			}
		});
	},
});